package com.liull.netty.cust_protocol;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @Author: liull
 * @Description: ChannelInitializer是一种特殊的ChannelInboundHandler
 * @Date: Created in 20:19 2020/9/25
 * @Modified By:
 */
public class PersonServerInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        // 自定义编解码器
        pipeline.addLast(new PersonDecoder());
        pipeline.addLast(new PersonEncoder());
        pipeline.addLast(new PersonServerHandler());
    }
}
